#include "switchctrl.h"
#include"ProtocalIdentifier.h"
#include "NetworkCommonFunction.h"

SwitchCtrl::SwitchCtrl(int light, bool deviceSwitch):
SenderCommand(GetProtocalIdentifier("SwitchControl")),
m_Light(light),
m_Switch(deviceSwitch)
{
}

void SwitchCtrl::constructCommandData(QByteArray &commandData)
{
	unsigned long commandCode = m_CommandType;
	unsigned long commandLength;
	commandLength = sizeof(m_Light)+sizeof(m_Switch);
	commandData.append(FBtoNetworkCharP(commandCode),4);
	commandData.append(FBtoNetworkCharP(commandLength),4);
	commandData.append(FBtoNetworkCharP(m_Light), sizeof(m_Light));
	commandData.append(FBtoNetworkCharP(m_Switch),sizeof(m_Switch));
}
